package com.ynny.chapter14.controller;


import com.ynny.chapter14.entity.User;
import com.ynny.chapter14.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserMapper userMapper;

    //下载的时候 有一个内置
    @GetMapping("/list")
    public ResponseEntity list(){


        List<User> users = userMapper.selectAll();


        return ResponseEntity.ok(users);
    }

}
